/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.cip.esymons.tesoreria.be;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import org.cip.esymons.eventos.be.Evento;
import org.cip.esymons.general.be.Solicitante;
import org.cip.esymons.tramite.be.DocumentoExterno;

/**
 *
 * @author Gilmar Montoya
 */
@Entity
@Table(name = "tes_det_caja_chica")
//@NamedQueries({@NamedQuery(name = "DetCajaChica.findAll", query = "SELECT d FROM DetCajaChica d")})
public class DetCajaChica implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "dec_codigo", nullable = false)
    private Long decCodigo;

    @Basic(optional = false)
    @Column(name = "dec_fecha", nullable = false)
    @Temporal(TemporalType.DATE)
    private Date decFecha;


    @Column(name = "dec_fechaPago")
    @Temporal(TemporalType.DATE)
    private Date decFechaPago;

    @Column(name = "dec_debe", precision = 20, scale = 4)
    private Double decDebe;

    @Column(name = "dec_haber", precision = 20, scale = 4)
    private Double decHaber;

    @Column(name = "dec_saldoCaja", precision = 11, scale = 2)
    private Double saldoCajaChica;

    @Basic(optional = false)
    @Column(name = "dec_concepto", nullable = false, length = 100)
    private String decConcepto;

    @Column(name = "dec_estado", nullable = false)
    private EnumEstadoDetCajaChica estado;

    @JoinColumn(name = "fk_cac_codigo", referencedColumnName = "cac_codigo", nullable = false)
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private CajaChica cajaChica;

    @JoinColumn(name = "fk_sol_codigo", referencedColumnName = "sol_codigo")
    @ManyToOne(fetch = FetchType.LAZY)
    private Solicitante solicitante;

    @JoinColumn(name = "fk_doc_codigodocgen", referencedColumnName = "fk_doc_codigodocgen")
    @ManyToOne(fetch = FetchType.LAZY)
    private ComprobanteEgreso comprobanteEgreso;
    
    @JoinColumn(name = "eve_codigo", referencedColumnName = "eve_codigo")
    @ManyToOne(fetch = FetchType.LAZY)
    private Evento evento;

    @JoinColumn(name = "fk_doc_codigoExterno", referencedColumnName = "doc_codigo")
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private DocumentoExterno documentoComprobante;

    public DetCajaChica() {
    }

    public DetCajaChica(Long decCodigo) {
        this.decCodigo = decCodigo;
    }

    public DetCajaChica(Long decCodigo, Date decFecha, String decConcepto) {
        this.decCodigo = decCodigo;
        this.decFecha = decFecha;
        this.decConcepto = decConcepto;
    }

    public Long getDecCodigo() {
        return decCodigo;
    }

    public void setDecCodigo(Long decCodigo) {
        this.decCodigo = decCodigo;
    }

    public Date getDecFecha() {
        return decFecha;
    }

    public void setDecFecha(Date decFecha) {
        this.decFecha = decFecha;
    }

    public Double getDecDebe() {
        return decDebe;
    }

    public void setDecDebe(Double decDebe) {
        this.decDebe = decDebe;
    }

    public Double getDecHaber() {
        return decHaber;
    }

    public void setDecHaber(Double decHaber) {
        this.decHaber = decHaber;
    }

    public String getDecConcepto() {
        return decConcepto;
    }

    public void setDecConcepto(String decConcepto) {
        this.decConcepto = decConcepto;
    }

    public CajaChica getCajaChica() {
        return cajaChica;
    }

    public void setCajaChica(CajaChica cajaChica) {
        this.cajaChica = cajaChica;
    }

    public Solicitante getSolicitante() {
        return solicitante;
    }

    public void setSolicitante(Solicitante solicitante) {
        this.solicitante = solicitante;
    }

    public ComprobanteEgreso getcomprobanteEgreso() {
        return comprobanteEgreso;
    }

    public void setcomprobanteEgreso(ComprobanteEgreso comprobanteEgreso) {
        this.comprobanteEgreso = comprobanteEgreso;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (decCodigo != null ? decCodigo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof DetCajaChica)) {
            return false;
        }
        DetCajaChica other = (DetCajaChica) object;
        if ((this.decCodigo == null && other.decCodigo != null) || (this.decCodigo != null && !this.decCodigo.equals(other.decCodigo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "org.cip.esymons.tesoreria.be.DetCajaChica[decCodigo=" + decCodigo + "]";
    }

    /**
     * @return the evento
     */
    public Evento getEvento() {
        return evento;
    }

    /**
     * @param evento the evento to set
     */
    public void setEvento(Evento evento) {
        this.evento = evento;
    }

    /**
     * @return the estado
     */
    public EnumEstadoDetCajaChica getEstado() {
        return estado;
    }

    /**
     * @param estado the estado to set
     */
    public void setEstado(EnumEstadoDetCajaChica estado) {
        this.estado = estado;
    }

    /**
     * @return the documentoComprobante
     */
    public DocumentoExterno getDocumentoComprobante() {
        return documentoComprobante;
    }

    /**
     * @param documentoComprobante the documentoComprobante to set
     */
    public void setDocumentoComprobante(DocumentoExterno documentoComprobante) {
        this.documentoComprobante = documentoComprobante;
    }

    /**
     * @return the decFechaPago
     */
    public Date getDecFechaPago() {
        return decFechaPago;
    }

    /**
     * @param decFechaPago the decFechaPago to set
     */
    public void setDecFechaPago(Date decFechaPago) {
        this.decFechaPago = decFechaPago;
    }

    /**
     * @return the saldoCajaChica
     */
    public Double getSaldoCajaChica() {
        return saldoCajaChica;
    }

    /**
     * @param saldoCajaChica the saldoCajaChica to set
     */
    public void setSaldoCajaChica(Double saldoCajaChica) {
        this.saldoCajaChica = saldoCajaChica;
    }

}
